#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>

#ifdef WIN32
	#ifndef _DEBUG
		#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )
	#endif
	#define ENABLE_NLS
	#define GETTEXT_PACKAGE			"hello3"
	#define PACKAGE_LOCALE_DIR		"./locale"
#endif

#ifdef ENABLE_NLS
	#  include <libintl.h>
	#  define _(String) gettext(String)
#else
	#  define _(String) (String)
#endif

void on_button_clicked(GtkWidget* button, GtkWindow *parent)
{
	GtkWidget *dialog;
	g_print("on_button_clicked\n");
	dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, _("Hello Poky!"));
	gtk_dialog_run(GTK_DIALOG(dialog));
	gtk_widget_destroy(dialog);
}

int main(int argc, char* argv[])
{
	GtkWidget *window, *table, *button;

#ifdef ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#endif

	gtk_init(&argc, &argv);
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(G_OBJECT(window),"delete_event",
			G_CALLBACK(gtk_main_quit),NULL);
	gtk_window_set_title(GTK_WINDOW(window),_("Hello World!"));
	gtk_widget_set_size_request (window, 320, 240);
	
	gtk_container_set_border_width(GTK_CONTAINER(window),10);
	button = gtk_button_new_with_label(_("Hello World!"));
	g_signal_connect(G_OBJECT(button),"clicked",
		G_CALLBACK(on_button_clicked),(gpointer)window);
			
	table = gtk_table_new (5, 3, TRUE);
	gtk_table_attach (GTK_TABLE (table), button, 0, 1, 0, 1, GTK_EXPAND, GTK_EXPAND, 0, 0);
	gtk_container_add(GTK_CONTAINER(window),table);
	
	gtk_widget_show_all(window);
	gtk_main();
	return FALSE;
}
